Skip to content

gh-139837: document attributes of objects recorded by warnings.catch_warnings#139893

Open
Aniketsy wants to merge 5 commits into
python:mainfrom
Aniketsy:doc-warnings-warningmessage-attrs
Open

gh-139837: document attributes of objects recorded by warnings.catch_warnings#139893
Aniketsy wants to merge 5 commits into
python:mainfrom
Aniketsy:doc-warnings-warningmessage-attrs

Conversation

@Aniketsy

@Aniketsy Aniketsy commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

#139837

This PR updates the documentation for :func:warnings.catch_warnings:

  • Explicitly lists the attributes guaranteed to be present on each recorded object.
  • Corrects the note to say output is suppressed to sys.stderr.

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !


📚 Documentation preview 📚: https://cpython-previews--139893.org.readthedocs.build/

@Aniketsy

Copy link
Copy Markdown
Contributor Author

@StanFromIreland Please review these changes when you get a chance.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 30, 2026
@serhiy-storchaka serhiy-storchaka requested a review from vstinner June 2, 2026 17:19
@serhiy-storchaka

Copy link
Copy Markdown
Member

@vstinner, could you please review this PR?

@read-the-docs-community

read-the-docs-community Bot commented Jun 2, 2026

Copy link
Copy Markdown

Comment thread Doc/library/warnings.rst Outdated
- ``lineno``: the line number in the file (int)
- ``file``: the file object used for output (if any)
- ``line``: the line of source code (if available)
- ``source``: the original object that generated the warning (if available)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WarningMessage now also has a module attribute (None by default).

Comment thread Doc/library/warnings.rst Outdated
Comment thread Doc/library/warnings.rst Outdated
Aniketsy and others added 2 commits June 3, 2026 16:59
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
@Aniketsy

Aniketsy commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@vstinner thanks for the review and suggestion, i've applied changes, please let me know if we need any further improvements.

@Aniketsy

Aniketsy commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

i think by updating branch, this ci fail will be green .

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants